<template>
  <div class="wrap-card">
    <div class="card">
      <h2>
        <slot name="title"></slot>
      </h2>
      <p>
        <slot name="subTitle"></slot>
      </p>
      <hr v-show="useSubTitle||useTitle">
      <div>
        <slot name="default"></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "card-self",
  data() {
    return {
      useTitle: false,
      useSubTitle: false
    }
  },
  watch(){
  },
  mounted() {
    this.useTitle = this.$slots.title !== undefined
    this.useSubTitle = this.$slots.subTitle !== undefined
    console.log(this.useTitle,this.useSubTitle)
  }
}
</script>

<style scoped lang="less">
.wrap-card {
  //padding: 30px 35px 45px 35px;
  position: relative;
  box-shadow: 0 0 0 #818181;
  transition: all 0.2s ease 0s;
  -webkit-transform: translateY(0px) translateX(0px);
}

.wrap-card:before,
.wrap-card:after {
  display: inline-block;
  position: absolute;
  content: " ";
  width: 100%;
  height: 3px;
  background: #818181;
  -webkit-transform: scaleX(0);
  transition: all 0.2s ease;
}

.wrap-card:before {
  top: 0;
  left: 0;
  -webkit-transform-origin: 0 0;
}

.wrap-card:after {
  bottom: 0;
  left: 0;
  -webkit-transform-origin: 100% 0;
}

.wrap-card:hover {
  box-shadow: 20px 20px 0 #818181;
  -webkit-transform: translateY(-10px) translateX(-10px);
  transition: all 0.2s ease 0.4s;
}

.wrap-card:hover:after,
.wrap-card:hover:before {
  -webkit-transform: scaleX(1);
}

.card {
  background: #ffffff;
  padding: 30px 35px 45px 35px;
  //margin-bottom: 30px;
  //height:100%;
  border: 1px solid rgba(129, 129, 129, 0.1);
}

.card:before,
.card:after {
  display: inline-block;
  position: absolute;
  content: " ";
  width: 3px;
  height: 100%;
  background: #818181;
  -webkit-transform: scaleY(0);
  transition: all 0.2s ease 0.2s;
}

.card:before {
  top: 0;
  left: 0;
  -webkit-transform-origin: 0 100%;
}

.card:after {
  top: 0;
  right: 0;
  -webkit-transform-origin: 0 0;
}

.card:hover:after,
.card:hover:before {
  -webkit-transform: scaleY(1);
}
</style>
